﻿package com.toncen.samepms.basic.domain;

import java.util.Date;

import com.toncen.samepms.common.AbstractDomain;
import com.toncen.samepms.common.IDomain;
import com.sky.common.string.StringUtils;
import com.sky.dataimport.DynamicCellDataCell;
import com.sky.dataimport.DynamicCellDataRow;
import com.sky.dataimport.DynamicRowDataCell;
import com.sky.dataimport.DynamicRowDataRow;
import com.sky.dataimport.StaticDataCell;
import com.sky.dataimport.StaticDataRow;
import com.sky.dataimport.datatype.DateDataType;
import com.sky.dataimport.datatype.IntegerDataType;
import com.sky.dataimport.datatype.StringDataType;
import com.sky.dataimport.formater.UtilDateDataFormater;
 
/**
 * 描述：流程操作日志表BASIC_PROCESS_LOG的domain文件
 * 
 * @author tch 
 */
@DynamicRowDataRow(title = "动态行流程操作日志", sheetIndex = 1, startRowIndex = 2, startCellIndex = 1, inserted = false)
@DynamicCellDataRow(title = "动态列流程操作日志", sheetIndex = 1, startRowIndex = 2, startCellIndex = 2, inserted = false)
@StaticDataRow(title = "静态行列流程操作日志", sheetIndex = 1)
public class ProcessLog extends AbstractDomain {
	/**
	 * 序列号
	 */
	private static final long serialVersionUID = 1370586410551L;
	/**
	 * 所属领域模型(不持久化)
	 */
	private IDomain domain;
	/**
	 * 业务类型
	 */ 
	@StaticDataCell(rowIndex = 1, cellIndex = 1, title = "业务类型")
	@DynamicRowDataCell(cellIndex = 1,  title = "业务类型", require = false)
	@DynamicCellDataCell(rowIndex = 1,  title = "业务类型", require = false)
	@StringDataType(max = 200 )
	private  String domainClass; 	 
    
	/**
	 * 业务标识
	 */ 
	@StaticDataCell(rowIndex = 2, cellIndex = 2, title = "业务标识")
	@DynamicRowDataCell(cellIndex = 2,  title = "业务标识", require = false)
	@DynamicCellDataCell(rowIndex = 2,  title = "业务标识", require = false)
	@IntegerDataType(msg = "必须为整数类型")
	private  long domainId=IDomain.UNSAVED_ID; 	 
    
	/**
	 * 操作阶段
	 */ 
	@StaticDataCell(rowIndex = 3, cellIndex = 3, title = "操作阶段")
	@DynamicRowDataCell(cellIndex = 3,  title = "操作阶段", require = false)
	@DynamicCellDataCell(rowIndex = 3,  title = "操作阶段", require = false)
	@StringDataType(max = 200 )
	private  String operateStep; 	 
    
	/**
	 * 操作意见
	 */ 
	@StaticDataCell(rowIndex = 4, cellIndex = 4, title = "操作意见")
	@DynamicRowDataCell(cellIndex = 4,  title = "操作意见", require = false)
	@DynamicCellDataCell(rowIndex = 4,  title = "操作意见", require = false)
	@StringDataType(max = 2000 )
	private  String operateOpinion; 	 
    
	/**
	 * 操作时间
	 */ 
	@StaticDataCell(rowIndex = 5, cellIndex = 5, title = "操作时间")
	@DynamicRowDataCell(cellIndex = 5, title = "操作时间", formater = UtilDateDataFormater.class, option = "yyyy-MM-dd", require = false)
	@DynamicCellDataCell(rowIndex = 5, title = "操作时间", formater = UtilDateDataFormater.class, option = "yyyy-MM-dd", require = false)
	@DateDataType
	private  Date operateTime=new Date(); 	 
    
	/**
	 * 操作人
	 */ 
	@StaticDataCell(rowIndex = 6, cellIndex = 6, title = "操作人")
	@DynamicRowDataCell(cellIndex = 6,  title = "操作人", require = false)
	@DynamicCellDataCell(rowIndex = 6,  title = "操作人", require = false)
	@IntegerDataType(msg = "必须为整数类型")
	private  User operator; 	 
    

	public ProcessLog() {
		super();
	}

	public IDomain getDomain() {
		if (domain == null) {// domain不存在
			if (!StringUtils.isEmpty(domainClass)) {// domain的名称指定，则通过反射获取domain
				try {
					domain = (IDomain) Class.forName(domainClass).newInstance();
					domain.setId(domainId);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}		
		return domain;
	}

	public void setDomain(IDomain domain) {
		this.domain = domain;
	}

	/**
	 * @return the  domainClass
	 */
	public  String getDomainClass() {
		if (StringUtils.isEmpty(domainClass)) {// domain名称没有指定，则取domain的类全名
			if (domain != null) {
				return domain.getClass().getName();
			}
		}		
		return  domainClass;
	}

	/**
	 * @param  domainClass
	 *            the  domainClass to set
	 */
	public void setDomainClass( String  domainClass) {
		this. domainClass =  domainClass;
	}
	
	/**
	 * @return the  domainId
	 */
	public  long getDomainId() {
		if (domainId == IDomain.UNSAVED_ID) {// domain名称没有指定，则取domain的id
			if (domain != null) {
				return domain.getId();
			}
		}		
		return  domainId;
	}

	/**
	 * @param  domainId
	 *            the  domainId to set
	 */
	public void setDomainId( long  domainId) {
		this. domainId =  domainId;
	}
	
	/**
	 * @return the  operateStep
	 */
	public  String getOperateStep() {
		return  operateStep;
	}

	/**
	 * @param  operateStep
	 *            the  operateStep to set
	 */
	public void setOperateStep( String  operateStep) {
		this. operateStep =  operateStep;
	}
	
	/**
	 * @return the  operateOpinion
	 */
	public  String getOperateOpinion() {
		return  operateOpinion;
	}

	/**
	 * @param  operateOpinion
	 *            the  operateOpinion to set
	 */
	public void setOperateOpinion( String  operateOpinion) {
		this. operateOpinion =  operateOpinion;
	}
	
	/**
	 * @return the  operateTime
	 */
	public  Date getOperateTime() {
		return  operateTime;
	}

	/**
	 * @param  operateTime
	 *            the  operateTime to set
	 */
	public void setOperateTime( Date  operateTime) {
		this. operateTime =  operateTime;
	}
	
	/**
	 * @return the  operator
	 */
	public  User getOperator() {
		return  operator;
	}

	/**
	 * @param  operator
	 *            the  operator to set
	 */
	public void setOperator( User  operator) {
		this. operator =  operator;
	}
	
}
